import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
// eslint-disable-next-line import/no-duplicates
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'

// eslint-disable-next-line import/no-duplicates
import { Indicator } from 'mint-ui'

Vue.use(MintUI)

Vue.config.productionTip = false // for bubble theme

axios.defaults.baseURL = 'http://127.0.0.1:8080/'
Vue.prototype.$http = axios

// 请求拦截
axios.interceptors.request.use(
  config => {
    // 加载动画
    Indicator.open()
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

// 响应拦截
axios.interceptors.response.use(
  response => {
    Indicator.close()
    return response
  },
  error => {
    // 错误提醒
    Indicator.close()
    return Promise.reject(error)
  }
)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
